package com.gdit.revenue.dao;

import com.gdit.revenue.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDao {

    //分页查询user表数据
    @Select("select * from user limit #{offset},#{limit}")  // 检索记录行 offset-limit   如：0-4 5-9
    List<User> getAllUsers(int offset,int limit);

    //统计user表总条数
    @Select("select count(*) from user")
    int count();

    //删除user表单单条数据
    @Delete("delete from user where userid=#{userid}")
    int delete(int userid);

    //向user表新增数据
    @Insert("insert into user (userid,username,password,name,role,number) values(#{userid},#{username},#{password},#{name},#{role},#{number})")
    int insert(User user);

    //修改user表数据
    @Update("update user set username=#{username},password=#{password},name=#{name},role=#{role},number=#{number} where userid=#{userid}")
    int update(User user);


}
